Catalyzes the transfer of a ribosyl phosphate group from 5-phosphoribose 1-diphosphate to the N(9) of hypoxanthine, guanine or xanthine, leading to IMP, GMP and XMP, respectively. Plays a central role in the generation of purine nucleotides through the purine salvage pathway. diphosphate + IMP = 5-phospho-alpha-D-ribose 1-diphosphate + hypoxanthine diphosphate + GMP = 5-phospho-alpha-D-ribose 1-diphosphate + guanine diphosphate + XMP = 5-phospho-alpha-D-ribose 1-diphosphate + xanthine Binds 2 magnesium ions per subunit. The magnesium ions are essentially bound to the substrate and have few direct interactions with the protein. Purine metabolism; GMP biosynthesis via salvage pathway; GMP from guanine: step 1/1. Purine metabolism; IMP biosynthesis via salvage pathway; IMP from hypoxanthine: step 1/1. Purine metabolism; XMP biosynthesis via salvage pathway; XMP from xanthine: step 1/1. Homotetramer. Belongs to the purine/pyrimidine phosphoribosyltransferase family.