A group-theoretical approach to enumerating magnetoelectric and multiferroic couplings in perovskites