Hi Some,
I’m not quite sure about how the rules regarding homework work (I haven’t been on this forum in a long time) but I would think that we can’t give direct answers. Here are a few things to investigate and keep in mind, though!
Check out the Translate() function in Processing (here)
You got the transformation right, as far as I can tell, but you’ve got a slight issue where you’re drawing the rectangle and the point around which you are rotating the rectangle. This is what causes it to fly around the screen.
Also, as for the flickering- the draw function loops, so the rectangle is being rotated every time it loops. Try implementing a function that rotates the rectangle on a mouse click or a button press. Good luck!