Linear stability of magnetohydrodynamic flow in a perfectly conducting rectangular duct