Structural Analysis of the Phase Transitions of (NH4)4HgBr6