Seminumerical contact transformations: From internal coordinate rovibrational Hamiltonian to effective rotational Hamiltonians. Framework of the method