WARNING: This page is about a different car, the 2003 Mazda Protege5 and 2003 Mazda Protege. However, it is still accessible from the selected car via links, so may be relevant.
Make marks on the gear and the base before disassembling the power window motor.