A compound of the formula: wherein: R 1 is a heterocycloamino ring substituted with R a, R b, and R c wherein: R a is -Z-Ar where Z is C 1-6 alkylene, C 1-6 haloalkylene, -O-, -C -, -NH-, or S n - wherein n is 0, 1, or 2; and Ar is C 3-10 cycloalkyl,C 3-7 heterocycloalkyl, C 3-7 heterocycloalkenyl, C 6-10 aryl, or C 1-9 heteroaryl wherein C 3-10 cycloalkyl, C 3-7 heterocycloalkenyl, C 3-7 heterocycloalkyl, C 6-10 aryl, and C 1-9 heteroaryl are optionally substituted with 1 to 3 substituents independently selected from C 1-6 alkyl, halo, hydroxy, oxo, C 1-6 alkoxy, C 1-6 thioalkoxy, C 1-6 haloalkyl, C 1-6 hydroxyalkyl, C 1-6 haloalkoxy, C 1-6 alkylcarbonyl, C 1-6 alkylsulphonyl, cyano, C 2-12 alkoxyalkyloxy, C 1-9 amide, or C 1-6 hydroxyalkyloxy; and R b and R c are independently hydrogen, C 1-6 alkyl, hydroxy, or halo; R 2 is -OR e or -NR d R e wherein R d is hydrogen or C 1-6 alkyl and R e is C 1-6 alkyl, C 1-6 haloalkyl, C 1-6 hydroxyalkyl, C 2-12 alkoxyalkyl, C 1-12 aminoalkyl, C 3-10 cycloalkyl, C 4-16 cycloalkylalkyl, C 6-10 aryl, C 1-9 heteroaryl, C 3-7 heterocyclyl, or C 3-7 heterocycloalkenyl wherein C 6-10 aryl, C 1-9 heteroaryl, C 3-7 heterocyclyl, and C 3-7 heterocycloalkenyl are optionally substituted with 1 to 3 substituents independently selected from C 1-6 alkyl, halo, hydroxy, oxo, C 1-6 alkoxy, C 1-6 haloalkyl or C 1-6 haloalkoxy, or cyano; all X 1 -X 4 are carbon or one or two of X 1 -X 4 are N and the rest of X 1 -X 4 are carbon; R 3, R 4, R 5, and R 6 are independently absent, hydrogen, C 1-6 alkyl, halo, hydroxy, C 1-6 alkoxy, C 1-6 alkoxycarbonyl, C 1-6 haloalkyl, C 1-6 haloalkoxy, C 1-9 amide, C 3-7 heterocyclyl, C 1-8 alkylamino, or cyano; or a pharmaceutically acceptable salt thereof, wherein heterocycloamino means a saturated monocyclic group of 4 to 8 ring atoms in which one or two ring atoms are a heteroatom selected from N, O, or S n, where n is an integer from 0 to 2, and provided that at least one ring member is N. R 1 is a heterocycloamino ring substituted with R a, R b, and R c wherein: R a is -Z-Ar where Z is C 1-6 alkylene, C 1-6 haloalkylene, -O-, -C -, -NH-, or S n - wherein n is 0, 1, or 2; and Ar is C 3-10 cycloalkyl,C 3-7 heterocycloalkyl, C 3-7 heterocycloalkenyl, C 6-10 aryl, or C 1-9 heteroaryl wherein C 3-10 cycloalkyl, C 3-7 heterocycloalkenyl, C 3-7 heterocycloalkyl, C 6-10 aryl, and C 1-9 heteroaryl are optionally substituted with 1 to 3 substituents independently selected from C 1-6 alkyl, halo, hydroxy, oxo, C 1-6 alkoxy, C 1-6 thioalkoxy, C 1-6 haloalkyl, C 1-6 hydroxyalkyl, C 1-6 haloalkoxy, C 1-6 alkylcarbonyl, C 1-6 alkylsulphonyl, cyano, C 2-12 alkoxyalkyloxy, C 1-9 amide, or C 1-6 hydroxyalkyloxy; and R b and R c are independently hydrogen, C 1-6 alkyl, hydroxy, or halo; R a is -Z-Ar where Z is C 1-6 alkylene, C 1-6 haloalkylene, -O-, -C -, -NH-, or S n - wherein n is 0, 1, or 2; and Ar is C 3-10 cycloalkyl,C 3-7 heterocycloalkyl, C 3-7 heterocycloalkenyl, C 6-10 aryl, or C 1-9 heteroaryl wherein C 3-10 cycloalkyl, C 3-7 heterocycloalkenyl, C 3-7 heterocycloalkyl, C 6-10 aryl, and C 1-9 heteroaryl are optionally substituted with 1 to 3 substituents independently selected from C 1-6 alkyl, halo, hydroxy, oxo, C 1-6 alkoxy, C 1-6 thioalkoxy, C 1-6 haloalkyl, C 1-6 hydroxyalkyl, C 1-6 haloalkoxy, C 1-6 alkylcarbonyl, C 1-6 alkylsulphonyl, cyano, C 2-12 alkoxyalkyloxy, C 1-9 amide, or C 1-6 hydroxyalkyloxy; and R b and R c are independently hydrogen, C 1-6 alkyl, hydroxy, or halo; R 2 is -OR e or -NR d R e wherein R d is hydrogen or C 1-6 alkyl and R e is C 1-6 alkyl, C 1-6 haloalkyl, C 1-6 hydroxyalkyl, C 2-12 alkoxyalkyl, C 1-12 aminoalkyl, C 3-10 cycloalkyl, C 4-16 cycloalkylalkyl, C 6-10 aryl, C 1-9 heteroaryl, C 3-7 heterocyclyl, or C 3-7 heterocycloalkenyl wherein C 6-10 aryl, C 1-9 heteroaryl, C 3-7 heterocyclyl, and C 3-7 heterocycloalkenyl are optionally substituted with 1 to 3 substituents independently selected from C 1-6 alkyl, halo, hydroxy, oxo, C 1-6 alkoxy, C 1-6 haloalkyl or C 1-6 haloalkoxy, or cyano; all X 1 -X 4 are carbon or one or two of X 1 -X 4 are N and the rest of X 1 -X 4 are carbon; R 3, R 4, R 5, and R 6 are independently absent, hydrogen, C 1-6 alkyl, halo, hydroxy, C 1-6 alkoxy, C 1-6 alkoxycarbonyl, C 1-6 haloalkyl, C 1-6 haloalkoxy, C 1-9 amide, C 3-7 heterocyclyl, C 1-8 alkylamino, or cyano; or a pharmaceutically acceptable salt thereof, wherein heterocycloamino means a saturated monocyclic group of 4 to 8 ring atoms in which one or two ring atoms are a heteroatom selected from N, O, or S n, where n is an integer from 0 to 2, and provided that at least one ring member is N.