For some reason in Photoshop, when you select multiple layers, right click them, and export them as images, fully transparent rows or columns of pixels on the edges of the image are trimmed and each layer can end up exported as a different size. There is no setting to disable this functionality. Individual layers with a reveal all mask will not be trimmed, but layer groups do not help their children. This leads to the core problem this script solves:
Photoshop doesn't provide a way to apply masks to multiple selected layers simultaneously.
Download this script, select the layers you want masked, and run the script.