Set the layer's blending mode to Stencil Alpha.
Tried it, but not working, am getting a black object when i set the stencil alpha mode. Both, for the image and even the mask.
You can use preserve underlying transparency with your masked layer or shape layer at the bottom then nest this comp in a comp with a background.
Or put your mask on the top layer and select stencil alpha as the blend mode for that layer and set the rest of the layers to normal.
In both cases, if you want a background layer that is really on the bottom of the layer stack you have to nest the composition in one with a background.
You could also use the Set Matte effect and pick the layer you want to use the source, but set matte will set the matte before any transformations occur so if you have rotated a layer you'll get unexpected results. I left the shape layer visible so you can see the results of the rotation and position on the underlying layer.