Thermal pions in a magnetic background