SMS dit: Derivation of the bidomain equations for a beating heart with a general microstructure