Nitrogen-doping induces tunable magnetism in ReS2