In particular, I want to know the penalty (if any) for teaching scripture to Mlecchas.
The following verse says that the sin a Brahmin commits by teaching someone who is undeserved is removed by Japa (reciting sacred texts) and Homa (burnt offerings).
Manu Smriti 10.111. The guilt incurred by offering sacrifices for teaching (unworthy men) is removed by muttering (sacred texts) and by burnt offerings, but that incurred by accepting gifts (from them) by throwing (the gifts) away and by austerities.
Another verse which is giving a punishment for revealing the secret of Vedas to strangers or to persons who are unworthy to know such secrets.
11.197. He who has sacrificed for Vratyas, or has performed the obsequies of strangers, or a magic sacrifice (intended to destroy life) or an Ahina sacrifice, removes (his guilt) by three Krikkhra (penances)
11.198. A twice-born man who has cast off a suppliant for protection, or has (improperly) divulged the Veda, atones for his offence, if he subsists during a year on barley