Evaluates the input signals from a SinCosResolver:
y[1] = offset + cos(p*phi)y[2] = offset - cos(p*phi)y[3] = offset + sin(p*phi)y[4] = offset - sin(p*phi)
to obtain the electrical angle phi and the electrial angular velocity w:
Subtracting the inputs pairwise  y[1] - y[2] and y[3] - y[4] eliminates the offset. 
The results are interpreted as real and imaginary part of a space phasor. 
Calculating the angle of the space phasor using atan2 gives the desired rotor angle, wrapped to the interval [0, 2*p). 
This calculation is sensitive on amplitude errors of the input signal, and the result cannot be differentiated.
An alternative algorithm with better stability and robustness is a tracking obeserver: The space phasor is rotated (Park-transform) by an angle that is determined by a fast integral controller bringing the imaginary part of the rotated phasor to zero. Differentiating the output gives the angular velocity.
Usually the number of pole pairs p matches the number of pole pairs of the permanent magnet synchronous machine. 
Therefore the results directly provide the electrical rotor angle, i.e. p*phiMechancial, and the electrial angular velocity, i.e. p*wMechancial.