Global stock markets are headed for their weakest quarterly performance in four years after a torrid summer.