I know there are many Jews who work for schools, synagogues, soup kitchens, and other such non-profit organizations that do a community service. Many people also give maaser money to these organizations. If you work for one of these organizations, does it count as maaser to give money to the organization that pays your salary?
Now even if you were to benefit directly or indirectly from your giving, the full amount donated would still be counted against your maaser. The classical case is when you get a decrease in your taxes, or a refund from the government, on a certain part of your giving.
R Shimon Taub (The Laws of Tzedakah and Maaser, p. 149) writes that
One who benefits by giving tzedakah because he ends up paying less taxes is not obligated to give that profit to tzedakah. Therefore if one would have had to pay $10,000 in taxes had he not given tzedakah, but because of all the tzedakah he gave must pay only $7,000, he is not obliged to give in the profit of $3,000 to tzedakah.
He references Igrot Moshe YD 1:143 that even real benefit coming from tzedakah belongs to the donor and not to tzedakah. As such one would have fulfilled one's obligation even if reimbursed in part. This is also the conclusion of R Ari Wasserman (in his book Making it work, see p. 14 of the PDF here) quoting the same Igrot Moshe and of R Chaim Kanievsky quoted here.