Margarine in place of shortening
Margarine is essentially 80% hydrogenated vegetable oil, the rest being mostly water and a touch of coloring and flavoring.

Shortening is essentially 100% hydrogenated vegetable oil.

That means that to truly substitute shortening versus margarine, you would need 5 units of margarine, versus 4 units of shortening plus one unit of water.

However,  in many, many applications substituting 1:1 is well within the tolerance of recipes.  This applies to almost all savory cooking, and most baking including breads, quick breads, cookies, and cakes.