According to Canon 742 of the 1917 Code of Canon Law, non-solemn baptism "can be administered by anyone, preserving the required matter, form, and intention."
This was only allowed in cases of danger of death, but it shows the minimum required for validity. The person administering the baptism does not need to be Catholic or Christian. A pagan or Jєω, for example, could do an emergency baptism. The intention needs to be the intent to do what the Church does, even if the person has an imperfect understanding of Catholic teaching on baptism or anything else.
An Arian would probably perform a valid baptism. I cannot imagine under what circuмstances a Mormon would intend to perform a Catholic baptism, but it is theoretically possible. The faith of the person performing the baptism does not affect its validity.