I can think of a way of doing checking the overlapping condition if the squares are aligned to the axes, however I am stumped about how to go about rotating my squares and still be able to check if two squares are overlapping.
One idea I had was to create my own rotation matrices while generating the squares, but is there a better way?