Quantum molecular dynamics in intense laser fields: Theory and applications to diatomic molecules