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.