Text this: Topological invariants based on generalized position operators and application to the interacting Rice-Mele model