Microscopic derivation of the Bohr–Mottelson collective Hamiltonian and its application to quadrupole shape dynamics