  We prove that the Jacquet-Langlands correspondence for cohomological
automorphic forms on quaternionic Shimura varieties is realized by a Hodge
class. Conditional on Kottwitz's conjecture for Shimura varieties attached to
unitary similitude groups, we also show that the image of this Hodge class in
$\ell$-adic cohomology is Galois invariant for all $\ell$.
