In a 4- to 5-quart pan over medium-high heat, stir onion, garlic, and oil often until onion is slightly browned, about 10 minutes.
Set aside 1/2 cup of the tomatoes and add the remainder to onion mixture. Stir often until tomatoes begin to soften, about 4 minutes.
Add beans and rosemary and stir occasionally over low heat to blend flavors, about 10 minutes. If bean mixture is thicker than desired, thin with water and bring to a simmer. Pour into a bowl and sprinkle with reserved tomatoes. Season to taste with salt and pepper.