3x3 cell iteration

Hi. i’m working on cellular automate. Starting from the first ofrect in the center of the screen I want to draw a 3x3 matrix of ofrect(with the first rect in the center of the matrix) and iterate it until the screen size. some suggestions?