Got it working!
Problem was trivial and nothing to do with the real/imaginary
mathematics. Which is surprising for a change.

The squareX and squareY functions were re-written to be closer
to the algebra I worked out, but I don't think this was nessessary
to get the programme working.

Problem lay in the x, y coordinate scaling, I had width and height
back to front.
Added reflect.txt, but not allowed to submit on OpenLearning