Phase transition and cationic motion in the perovskite formate framework [(CH3)2NH2][Mg(HCOO)3]