First of all, the process you're describing will always generate a phase between 90 and 270.
Now to do what you want ot do in a somewhat brute force way is as follows:
1. Calculate the number of samples in your data between the the 90 degree point and the 270 degree point.
2. Because the number of degrees between 90 and 270 is 180, divide this number by 180 to calculate the number of degrees each sample in your waveform represents.
3. Threshold your input waveform (starting at the 90 degree point) to find the sample where that value occurs.
4. Divide this value by the number calculated in step 2. The result is the phase shift of the data value.
I have written an example showing one way to implement this functionality.
Mike...