A 4.0 magnitude earthquake has been recorded off the WA coast.