James Dayton has agreed to join Oldham Athletic on a two-year contract after rejecting a three-year deal at Kilmarnock.