Consider an equilateral

ABC with one of the vertex say A on the origin and side AB along X-axis. So coordinates of the vertices can be assigned as
A(0,0); B(a,0) and C(a/2, a

3/2)
If masses m, 2m and 3m are placed on the vertices A, B and C respectively then coordinates of center of mass C(X,Y) can be expressed as
X = [0*m + a*2m + (a/2)*3m]/6m
or X= 7a/12
Similarly Y
= [0*m + 0*2m + (a

3/2)*3m]/6m = a

3/4
so
Y = a
3/4
Now consider coordinates of square ABCD with side 'a' to be
A(0,0); B(0,a); C(a,a) and D(0,a) with masses m, 2m, 3m and 4m respectively and try to locate the center of mass.