We propose an effective field theory to describe hadrons with two heavy quarks without any assumption on the typical distance between the heavy quarks with respect to the typical hadronic scale. The construction is based on nonrelativistic QCD and inspired in the strong coupling regime of potential nonrelativistic QCD. We construct the effective theory at leading and next-to-leading order in the inverse heavy quark mass expansion for arbitrary quantum numbers of the light degrees of freedom. Hence our results hold for hybrids, tetraquarks, double heavy baryons and pentaquarks, for which we also present the corresponding operators at a nonrelativistic level. At leading order, the effective theory enjoys heavy quark spin symmetry and corresponds to the Born-Oppenheimer approximation. At next-to-leading order, spin and velocity-dependent terms arise, which produce splittings in the heavy quark spin symmetry multiplets. A concrete application to double heavy baryons is presented in an accompanying paper.