How to find the center of mass of several objects in a 2d plane? We have the following scenario in a 2d plane: a big rectangle with a lot of smaller similar  uniform rectangles in it,  all of them weight differently. 
Where is the center of mass of this object found by a formula?
To generalise it (In a 2d plane):
We have a shape, composed of different shapes, which might be similar or not. We know all the small shapes' centers of mass. 
Where is the center of mass of the larger shape?
For example one, here is an image: 
 A: 
Let bottomleft point be $(0,0)$ and assuming each small segment is a uniform square of side 1 unit. The $y$ coordinate of the center of mass will be 
$y_{cm}=\dfrac{28\cdot4.5+35\cdot3.5+27\cdot2.5+27\cdot1.5+26\cdot.5}{143}\approx2.58$
Similarly the x coordinate will be,
$x_{cm}=\dfrac{23\cdot4.5+31\cdot3.5+21\cdot2.5+28\cdot1.5+40\cdot.5}{143}\approx2.28$
So, if the bottom left point of the body is considered as the origin the center of mass will be located at $(2.58,2.28)$.

Note:- This method is also applicable if small segments are uniform rectangles, provided their lengths and breadths.  
A: The center of mass (or gravity) is given by the formula (see Wikipedia, http://en.wikipedia.org/wiki/Center_of_mass)
$$ (1) \ \Sigma_{i=0}^N \ m_i (\vec r_i - \vec R) = 0$$
If someone has a problem with the uniformity of the shapes, then we can replace the sum by an integral, and inside each shape consider the mass as a function of $\vec r$, i.e. $m(\vec r)$ 
$$ (1') \ \vec i\int dx \frac {∂m}{∂x} \ (x - X) + \ \vec j\int dy \frac {∂m}{∂y} \ (y - Y) + \ \vec k\int dz \frac {∂m}{∂z} \ (z - Z)  = 0$$ 
But it is more convenient to work with sums, and assume that each point $m_i$ is sufficiently small to have inside itself a homogeneous structure.
From the formula (1) we can elaborate and find $\vec R$ as a function of the centers of mass of the different shapes that you are given.
The procedure below is easy to generalize to 3D.
Let's separate the index $i$ into two indexes, $j$ and $k_j$, where $j$ runs over the shapes, and $k_j$ over each particular shape, if we divide each particular shape into very small points carrying mass, as said above.
For instance, for the shape no. $j$, we have
$$ \Sigma_{k_j = 0}^{N_j} \ m_{k_j}[ (\vec r_{k_j} - \vec R_j) - (\vec R_j - \vec R)] $$
$$ = \Sigma_{k_j = 0}^{N_j} \ m_{k_j} (\vec r_{k_j} - \vec R_j) - \Sigma_{k_j = 0}^{N_j}(\vec R_j - \vec R) $$
$$ = \Sigma_{k_j = 0}^{N_j} \ m_{k_j} (\vec r_{k_j} - \vec R_j) - \Sigma_{k_j = 0}^{N_j} \ m_{k_j}(\vec R_j - \vec R) $$
Now, let me denote by $M_j$ the mass of the shape no. $j$.
Therefore
$$ \Sigma_{k_j = 0}^{N_j} \ m_{k_j}[(\vec r_{k_j} - \vec R_j) - (\vec R_j - \vec R)] $$
$$ = \Sigma_{k_j = 0}^{N_j} \ m_{k_j} (\vec r_{k_j} - \vec R_j) - M_j(\vec R_j - \vec R) $$
Now, I require for the object no. j that the position $\vec R_j$ be its center-of-mass, i.e. in line with the general formula (1),
$$ \Sigma_{k_j = 0}^{N_j} \ m_{k_j} (\vec r_{k_j} - \vec R_j) = 0,$$
s.t. we have 
$$ (2) \ \vec R_j = \frac {\Sigma_{k_j = 0}^{N_j} \ m_{k_j} \vec r_{k_j}}{M_j} $$
Now we can return safely to the situation of all our block of shapes. I will denote by $J$ the number of shapes
$$ (3) \ \Sigma_{i=0}^N \ m_i (\vec r_i - \vec R) = \Sigma_{j=0}^J \ M_j(\vec R_j - \vec R) = 0.$$
That's it! We have
$$ (4) \ \vec R = \frac {\Sigma_{j=0}^J \ M_j \vec R_j} {\Sigma_{j=0}^J \ M_j} .$$
where each $R_j$ is given, as you say.
