Hi

I am trying to make a loop that will produce squares in the following pattern:

I am doing this by plotting coordinates so for example:

starting position: 0,0

move to: 500,0

move to: 500,500

move to 0,500

move to: 0,0

starting position: 250,0

move to: 500,250

move to: 250,500

move to: 0,250

move to: 250,0

I am trying to figure out if there's an algorithm I could use to determine the coordinates for the next set of lines. I've spent so long on this and still can't seem to get my head around it, I'm not even sure if it's possible any more.

Any help would be greatly appreciated.