We study mod p Hilbert modular varieties associated to a totally real field L of degree g under the assumption that p is maximally ramified in OL, the ring of algebraic integers of L. We associate to each OL-abelian variety A over an Fp-algebra integer invariants 0 ≤ j ≤ n ≤ g−j that are used to define disjoint locally closed sets W(j,n) of the moduli space. The invariants encode some of the structure of H1(A, OA) as an OL[F]-module. We prove that the sets W(j,n) are nonempty, regular subvarieties of dimension g−(j+n). Moreover, the Newton polygon is constant on W(j,n) having two slopes (λ(n), 1−λ(n)), each with multiplicity g, where λ(n) = min(1/2, n/g). Using Hecke correspondences at p and Moret-Bailly families, we prove that the collection {W(j,n): 0 ≤ j ≤ n ≤ g−j} is indeed a stratification: the boundary is a union of strata. Furthermore, the singularity stratification of Deligne-Pappas, the Newton stratification, and the a-number stratification, all have a simple expression as a union of our strata. We affirm general conjectures on Newton strata for this class of varieties, that they form a stratification, that they have the expected dimension (each strata being of codimension 1 in the previous strata), and that the Grothendieck conjecture holds.