Preheat the oven to 350°F (180°C).
Trim the chicken thighs: remove skin if desired and trim excess fat (including the pocket of fat on the back) using a knife or kitchen shears.
Season both sides of the trimmed chicken thighs generously with salt and black pepper.
Heat a large frying pan over medium-high heat and add 2–3 teaspoons of olive oil.
Brown the chicken thighs in the hot pan on both sides without rushing, about 10 minutes total, until well browned.
Remove the browned chicken and place it in a glass casserole dish.
Pour off most of the fat from the frying pan if there is a lot remaining, then add the sliced red onion and cook about 2 minutes.
Add the sliced mushrooms to the pan and cook about 5 minutes more, until the liquid has mostly evaporated.
Stir in the ground rosemary (or minced fresh rosemary) with the onion and mushrooms.
Spoon the partly-cooked mushrooms and onions over the chicken pieces in the casserole dish.
Roast in the preheated oven for 35–45 minutes, until the chicken is cooked through and the vegetables are tender.
Serve hot, spooning any juices from the dish over the chicken and garnishing with chopped fresh parsley if desired.