Set a object's anchoredposition dynamically [Answered]

Hi, I’m building a jigsaw-type puzzle game, where I have a board with a variable number of squares. the board itself has a size of 6000x6000, and I want to place the squares in the board dynamically. I can change the size of the squares, but my problem is placing them side-by-side in the board without overlapping or being outside the board.

As an example, if my board is a 5x5, then the size of each square would be 1200x1200 and the recttransform position in the top left corner should be -2400x2400, next over is at -1200x2400, etc. If the board is a 6x6, then the square is 1000x1000 with a top left position of -2500x2500.

Nevermind, just figured it out