The coprecipitation of rare-earth elements with calcite and aragonite