A magnitude 6.4 earthquake has struck southern Taiwan, leaving 27 people with minor injuries and some reported damage.