Preheat broiler. Toss tomatoes and onion with 2 teaspoons oil, 1/2 teaspoon salt, and the red-pepper flakes. Broil on a rimmed baking sheet until tomatoes are just starting to brown, 5 to 7 minutes.
Meanwhile, bring a large pot of water to a boil. Cook pasta according to package directions until al dente. Drain pasta, reserving 1/2 cup cooking water.
Toss warm pasta with garlic, remaining 2 teaspoons oil, and 3/4 teaspoon salt. Stir in tomato mixture and the oregano. Add 1/4 cup reserved cooking water to moisten; stir in remaining water as needed. Divide pasta among 4 bowls, and stir 1 tablespoon ricotta into each.