Another way is on your first layer take the rounded rectangle tool and make the box, and then on each layer after it create a clipping mask.