The S&P 500 and Nasdaq posted their biggest monthly percentage drops of the year, while all three major indexes had their first quarterly declines in 2023.