Two-dimensional collective Hamiltonian for chiral and wobbling modes