I would try to align the anchor of the shape layers to left. Try using this script i made for anchor point placement.
Then add to the position the part of the sourceRectAtTime that you want. If you want one rectangle to be to the left of the other, then position should have something like this:
prevPosition = thisComp.layer("Rectangle 1"). position;
prevWidth = thisComp.layer("Rectangle 1").sourceRectAtTime(time,false).width;
[prePosition[0]+prevWidth, value[1]]
Similar to this, if you want them to be one under the other, you use the anchorPoint script. This is even easier. Set the anchorPoint to the top left for the bottom layer and bot left to the top layer. And let’s say you want the bottom layer to be aligned vertically and with a 20 px space under the top. Top being Rectangle 1, this is the position expression:
prevPosition = thisComp.layer("Rectangle 1").position;
padding = 20;
[prevPosition[0]+padding, prevPosition[1]]
Andrei
My Envato portfolio.