For the following system:

x1 := M*(cos(phi)-a*cos(3*phi)) / (1-b*cos(2*phi))

x2 := M*(cos(phi)+a*cos(3*phi)) / (1+b*cos(2*phi))

y1 := M*(sin(phi)-a*sin(3*phi)) / (1-b*cos(2*phi))

y2 := M*(sin(phi)+a*sin(3*phi))/ (1+b*cos(2*phi))

I'd like to find M(x1,x2,y1,y2) if possible; that is, I'd like to solve for M in terms of x1, x2, y1, and y2, eliminating a, b, and phi.

I've tried

solve({x1=X1, x2=X2, y1=Y1, y2=Y2},{M,a,b,phi},AllSolutions);