[SOLVED] How do you individually rotate objects in a grid?

Thanks a lot kll!! It works flawlessly.
I can’t believe how close I was. I’ve implemented the push-/popMatrix(); and translate(); functions exactly this way, but I forgot to alter the values of the square. I kept it at rect(x,y,0,0);.
How does the translate function ‘carry’ all the x, y values over to each rect? I don’t know if I understand it 100% completely. If you want could you elaborate a bit more?
If not thanks either way! I can finally keep tinkering on this sketch now, this had me stuck in a rud for nearly a week.