Iranian media said a moderate quake had shaken the capital around midnight local time.