Nonadiabatic optomechanical Hamiltonian of a moving dielectric membrane in a cavity