firstly generalize the problem: colour any finite number of arbitrary chosen grid's cells and consider we want to find the center of mass of this coloured figure.
then, draw a finer square grid: let a be the parameter of current grid's cell, the parameter of new grid's cell will be b=a/2 and the new grid will be placed such that it contains the current grid. obviously you can do this with ruler only, and sufficiently large grid will suffice (we don't want to keep drawing the new grid forever).
pick a point that lies on the new grid but not on the old grid, i.e. the point lies in the center of some cell of the old grid. label this point 0.
horizontal line passing through 0 label x, vertical line passing through 0 label y.
now, let our figure consist of n coloured squares of the old grid. measure x-coordinates of centres of all n squares (note that the coordinates are multiples of a, so specially multiples of b), add them so you get some number pb and mark the result on the axe x. measure y-coordinates of centres of all n squares, add them so you get some number qb and mark the result on the axe y.
if p=0 and q=0, you are done. if not, mark the point (pb,qb) on the new grid. all you need to do now is to find, using ruler only, the point that lies on the segment 0,(pb,qb) and whose distance from 0 is 1/n of the distance from 0 to (pb,qb). can you do this?