Seol mar théacs é seo: The quasi-geostrophic theory of the thermal shallow water equations