For the full moon, earth should be in the centre of the moon and the sun.
Order from left to right should be : Moon , Earth , sun
For New moon, Moon should be in the centre of the earth and the sun,
Order from left to right should be : Earth, Moon ,Sun
For first quarter, moon should be vertically above of the earth and sun be in right side of the earth.
For last quarter, Moon should be Vertcally below the earth and Sun should be in Sun side of the earth.