What you need is a hierarchy of transformations. Essentially, what is done all the time in 3D, only you use 2D math for it. So instead of 4x4 affine matrices, you have 3x3 affine matrices.
Each individual shape needs to have a local transform. The rotation of itself around its center (relative to a neutral rotation), and the translation of itself to that center point relative to its parent object. You build this transformation as a 3x3 matrix.
You need a hierarchy of objects: a tree. Your "body" is a node in the tree. It has child nodes: two upper legs, two upper arms, and a head. Each upper leg has a lower leg as a child, just as each upper arm has a lower arm as a child. And so on.
So, when it comes time to draw everything, you accumulate matrices. You get the body's transform matrix, transform the body by it, and render it. Then you get every child of the body, multiply its transform by its parent, transform that shape by that new matrix, and render it. Then, for each of these, you repeat the process: take the parent matrix, apply its local matrix to that parent matrix, transform the object by the new matrix, and render it. Recurse through the entire hierarchy of objects.
Really, the best way to understand this is to look at how 3D renderers do it. 2D rendering is just a special case of this, where you only rotate around Z and only have a 2D translation.