Revealing the structural role of MgO in aluminosilicate glasses