Python code for a rotating square