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